Skip to content

Fix insecure exception/response logging in LLMJudgeForLegalSurvey - #2

Open
denis-samatov wants to merge 1 commit into
AnkunHuang:mainfrom
denis-samatov:pr-legal-judge-secure-logging
Open

Fix insecure exception/response logging in LLMJudgeForLegalSurvey#2
denis-samatov wants to merge 1 commit into
AnkunHuang:mainfrom
denis-samatov:pr-legal-judge-secure-logging

Conversation

@denis-samatov

Copy link
Copy Markdown

Summary

Raw LLM responses and exception objects were being logged directly in LLMJudgeForLegalSurvey, which could leak sensitive information (PII, secrets, internal system details) into logs.

  • Replace generic except Exception as e with a specific exceptions.GoogleAPICallError catch plus a sanitized general except clause
  • Remove response.text from JSONDecodeError log messages
  • Remove the exception object from all log messages
  • Add the google.api_core exceptions import needed for the specific catch

Note: this diff also reformats the notebook's JSON (pretty-printed instead of minified), a side effect of editing it programmatically — the only functional change is the logging fix described above.

Test plan

  • Confirm log output for a simulated GoogleAPICallError and a JSONDecodeError no longer includes raw response text or exception details

Raw LLM responses and exception objects were being logged directly,
which could leak sensitive information (PII, secrets, internal
system details) into logs.

- Replace generic 'except Exception as e' with a specific
  exceptions.GoogleAPICallError catch plus a sanitized general
  except clause.
- Remove response.text from JSONDecodeError log messages.
- Remove the exception object from all log messages.
- Add the google.api_core exceptions import needed for the specific
  catch.

Note: this diff also reformats the notebook's JSON (pretty-printed
instead of minified), a side effect of editing it programmatically;
the only functional change is the logging fix described above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant